﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

//1-1中，使两个平台开移动，激活激光
public class Trigger_D : TriggerArea
{
    [SerializeField]
    private List<Platform_Movable> platforms_start;
    [SerializeField]
    private Laser laser;
    [SerializeField]
    private bool b_cameraShake; //是否会引发相机震动

    protected override void OnEnter(Collider2D collider)
    {
        StartCoroutine(OnTouchPlayer());
    }

    private IEnumerator OnTouchPlayer()
    {
        if(b_cameraShake)
            CameraImpulseLauncher.Instance.Launch();
        foreach (Platform_Movable obj in platforms_start)
        {
            if(!obj.b_started)
                obj.DelayStart();
        }
        yield return new WaitForSeconds(0.5f);
        laser.Active = true;
    }
}
